import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/home.vue'
import Error from "../views/error/error.vue"

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  // 一级菜单中icon为iview框架中icon名
  routes: [
    {
      path: '/',
      name: '日志',
      icon: 'ios-albums',
      show: true,
      component: HomeView,
      children: [
        {
          path: '/elec',
          name: '电动轮椅日志',
          component: () => import("@/components/log/elecLog.vue"),
        },
      ],
    },
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (About.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import('../views/AboutView.vue'),
    // },
    {
      path: '/:pathMatch(.*)',
      name: 'error',
      component: Error,
      meta: { title: '404' },
    },
  ],
})

export default router
